package org.cptz.game.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.cptz.game.constant.Const;
import org.cptz.game.constant.EnumConst;

@Data
public class ResultDto {
    private Object data;
    private String code;
    private String desc;

    public ResultDto(EnumConst.RespCode respCode) {
        this.code = respCode.getCode();
        this.desc = respCode.getDesc();
    }

    public ResultDto(EnumConst.RespCode respCode, Object data) {
        this.code = respCode.getCode();
        this.data = data;
    }

    public static ResultDto success(Object data) {
        return new ResultDto(EnumConst.RespCode.SUCCESS, data);
    }

    public static ResultDto error(Object data) {
        return new ResultDto(EnumConst.RespCode.ERROR, data);
    }
}
